Sequence Diagram for the Parking Lot
Create a sequence diagram for the card payment in the parking lot system and solve a challenge.
We'll cover the following
A sequence diagram is a great way to understand the interactions between different entities and objects in the system. There can be different sequence diagrams that we can create for our parking lot system. For the sake of this lesson, we will create sequence diagrams for the following two interactions:
Card payment: This performs a payment using the card.
Sequence challenge: This is for payment verification.
Card payment#
The sequence diagram for the card payment should have the following actors and objects that will interact with each other:
Actor:
Customer
Object:
CardReader
,Payment
, andExitPanel
Here are the steps in the card payment interaction:
The customer inserts the card into the card reader.
The card reader initiates a payment for the required parking fee.
The payment processes the payment and returns the payment status.
The card reader ejects the card.
If the payment is successful:
The customer requests a receipt for the transaction.
The exit panel prints a receipt for the customer.
If the payment is unsuccessful:
The customer sees an error message for an unsuccessful Payment.
Note: The
Payment
object is created when a vehicle enters the parking lot.
Based on the order above, the sequence diagram of the card payment in a parking lot system is given below.
Sequence challenge: Payment verification#
In this section, you will help us in completing a sequence diagram for the payment verification of a customer at the exit panel.
The skeleton below represents the payment verification sequence diagram. Here the payment status of the ticket is currently unpaid and the parking fee has to be calculated.
Notice that the arrows in the diagram above are numbered from 1 to 6. The message boxes shown below are the messages to be exchanged between the actor(s) and object(s). Can you rearrange the messages below in the correct sequence of the order they should appear in the skeleton of the sequence diagram given above?
Note: If you get stuck, just click the “Show Solution” button for the correct answer.
Alternatively, you can also click the "Show complete diagram" button below to see the complete sequence diagram.
In the next lesson, we will create activity diagrams for the parking lot design problem.
Class Diagram for the Parking Lot
Activity Diagram for the Parking Lot